/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package healthcaresystem.services;

import healthcaresystem.ADBService;
import healthcaresystem.controler.UserInfo;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Veho
 */
public class LoginService extends ADBService {
    
    
    public UserInfo checkUser(String sql){
        //boolean re=false;
        String userName;
        UserInfo us=null;
        try {
            Statement stemnet=conn.createStatement();
            ResultSet rs=stemnet.executeQuery(sql);
            us=new UserInfo();
            if(rs!=null && rs.next()){
                userName=rs.getString("userName");
                us.setUserName(userName);
            }
            
        } catch (SQLException ex) {
            Logger.getLogger(LoginService.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        return us;
    }


    
}
